class Node
	{
		int data;
		Node next;
		Node(int data, Node next)
		{
			this.data = data;
			this.next = next;
		}
	}


class Linkedlist
{
	protected Node head, tail;
	

     Linkedlist()
	{
    }

	public void clear()          // clear all content of list to 0
	{
		while (head != null)
		{
			head.data = 0;
			head = head.next;
		}
		
	}

	public void add(int d)
	{   Node temp;
		if (head == null)
	        {
			temp =new Node(d, null);
		    head = tail =temp;
	        }
		    else
		{
			Node n = new Node(d, null);
			n.next = head;
			head = n;
		}
		
	}

	public void getList()
	{
		Node n = head;

		if(n == null)
			System.out.println("Empty List");

		while(n != null )
		{
			System.out.println(n.data);
			n = n.next;
		}
	}

	public int getFirst()
	{
		return head.data;
	}

	public int getLast()
	{
		return tail.data;
	}

	public int removeFirst()
	{
		if (head == null)
		{    System.out.print("List is Empty");
			return -1;
		}
		int d = head.data;
		head = head.next;
	    return d;
	
	}

	/*public int removeLast()
	{
            ******* Home work ****
	}
	
	*/
}
// *****************************************************
	//private
	


public class LinkedlistDemo
{
	public static void main(String[] args)
	{
		Linkedlist L1= new Linkedlist();
		//L1.add(2);
		L1.head=new Node(1,new Node(2,new Node(3, null)));
		L1.add(4);
		L1.add(60);
		L1.add(25);
		L1.add(45);
		L1.add(605);
		L1.getList();
		
	}
}